package com.jingbian.study.config;

import io.swagger.v3.oas.models.ExternalDocumentation;
import io.swagger.v3.oas.models.OpenAPI;
import io.swagger.v3.oas.models.info.Contact;
import io.swagger.v3.oas.models.info.Info;
import org.springdoc.core.models.GroupedOpenApi;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableAutoConfiguration
@ConditionalOnProperty(name = "swagger.enable", matchIfMissing = true)
public class SwaggerConfiguration {

    @Bean
    public OpenAPI docsOpen2Api()
    {
        return new OpenAPI()
                .info(new Info()
                        .title("这是标题")
                        .description("这是介绍")
                        .termsOfService("https://www.baidu.com")
                        .version("版本")
                        .contact(new Contact().name("作者姓名"))
                )
                .externalDocs(new ExternalDocumentation()
                        .description("接口有问题?点这里!")
                        .url("https://baidu.com/"));
    }


}